package com.amigo.online.provider.compare.quartzjob.random;

import java.util.List;
import java.util.stream.Collectors;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import com.amigo.online.provider.common.ConstantValue;
import com.amigo.online.provider.common.entity.UserMongoInfo;
import com.amigo.online.provider.common.entity.UserMysqlInfo;
import com.amigo.online.provider.common.entity.UserSolrInfo;
import com.amigo.online.provider.compare.quartzjob.AbstractCompareJob;
import com.amigo.online.provider.compare.quartzjob.AbstractUserComparisonJob;
import com.amigo.online.provider.compare.service.UserComparisonService;
import com.amigo.online.provider.sync.handle.data.mongo.service.UserMongoService;
import com.amigo.online.provider.sync.handle.data.solr.service.UserSolrService;

/**
 * @version: V 1.0.0
 * @Description: （对类进行功能描述）
 * @author: zxy  QQ:1363320658
 * @date: 2018年12月10日 下午6:12:31
 */
public class UserInfoRandomComparisonJob extends AbstractUserComparisonJob implements Job {

    @Autowired
    UserComparisonService userComparisonService;

    @Autowired
    UserSolrService userSolrService;

    @Autowired
    UserMongoService userMongoService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        List<UserMysqlInfo> UserMysqlList = userComparisonService.listUserInfoWithNumber(ConstantValue.RANDOM_COMPARSION_NUMBER);
        List<Long> ids = UserMysqlList.stream().map(obj -> obj.getId()).collect(Collectors.toList());
        List<UserSolrInfo> UserSolrList = userSolrService.listFindUserByIds(ids);
        List<UserMongoInfo> UserMongoList = userMongoService.listUserMongoInfoByIds(ids);
        //compareUser(UserMongoList, UserSolrList, UserMysqlList);
    }


}
